import { Spin } from 'antd';
import { Suspense } from 'react';
import {
  BrowserRouter as Router,
  Switch,
  Redirect,
  Route,
} from 'react-router-dom';
import routesConfig from './routes';

const App = () => {
  return (
    <Router>
      <div style={{ minHeight: '100vh', position: 'relative' }}>
        {/* 待编写 */}
        {/* <Headers /> */}
        {/* 加载组件 */}
        <Suspense
          fallback={
            <div className='w-full h-full flex items-center justify-center'>
              <Spin size='large' />
            </div>
          }>
          <Switch>
            {routesConfig.map((item, index) => (
              <Route
                key={index}
                path={item.path}
                exact={item.exact}
                component={item.component}
              />
            ))}
            <Redirect exact from='/' to='/home' />
          </Switch>
        </Suspense>
        {/* <Footer /> */}
      </div>
    </Router>
  );
};

export default App;
